home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / editor / frexxed / fpl / statuslineclock.fpl < prev    next >
Text File  |  1995-08-06  |  2KB  |  67 lines

  1. string real_line, real_title;
  2. int time_id;
  3. int clockmode;
  4. int expunge;
  5.  
  6. export int ClockUpdate()
  7. {
  8.   string clockline;
  9.   if (expunge) {
  10.     expunge=0;
  11.     switch(clockmode) {
  12.     case 1:
  13.       /* replace old status line */
  14.       SetInfo(0, "status_line", real_line);
  15.       break;
  16.     case 2:
  17.       /* replace old window title */
  18.       SetInfo(0, "window_title", real_title);
  19.       break;
  20.     }
  21.     clockmode=ReadInfo("clock");
  22.     if (!clockmode) {
  23.       /* delete old one! */
  24.       TimerDelete( time_id );
  25.       time_id = 0;
  26.       return;
  27.     }
  28.   }
  29.   switch(clockmode) {
  30.   case 1:
  31.     SetInfo(0, "status_line", real_line + " " + substr(GetDate(-1,2), 1, 5));
  32.     break;
  33.   case 2:
  34.     SetInfo(0, "window_title", ReadInfo("version_id") +"  " + substr(GetDate(-1,2), 1, 5));
  35.     break;
  36.   }
  37. }
  38.  
  39. export void ClockToggle(void)
  40. {
  41.   switch(ReadInfo("clock")) {
  42.   case 1:
  43.     real_line = ReadInfo("status_line"); /* store the real one! */
  44.     break;
  45.   case 2:
  46.     real_title= ReadInfo("window_title"); /* store the real one! */
  47.     break;
  48.   }
  49.   if (!time_id)
  50.     time_id = TimerAdd(1, "ClockUpdate();", 10);
  51.   expunge=1;
  52.   ExecuteLater("ClockUpdate();");
  53. }
  54.  
  55. export int ClockQuery(void)
  56. {
  57.   return Request("This feature updates a clock string\n"
  58.                  "on the right edge of your status line\n"
  59.                  "or in the window title (if registered).\n"
  60.                  "When in use, you won't be able to change\n"
  61.                  "status line appearance. Want it?",
  62.                  "Just answer",
  63.                  "status line|window title|off");
  64. }
  65.  
  66. ConstructInfo("clock", "ClockToggle();", "ClockQuery();", "WCG", "off|status|title", 0, 0);
  67.